package com.edwin.springjdbc.dao.impl;

import java.util.List;

import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import com.edwin.springjdbc.dao.AddNumberDao;
import com.edwin.springjdbc.dto.AddNumberDto;

@SuppressWarnings({"unchecked","rawtypes"})
public class AddNumberImpl implements AddNumberDao {
	
	private JdbcTemplate template;
	
	public JdbcTemplate getTemplate(){
		return template;
	}
	
	public void setTemplate(JdbcTemplate template){
		this.template=template;
	}
	
	public List<AddNumberDto> getAddNumberDtos() {
		String sql="select * from addnumber limit 1";
		return (List<AddNumberDto>) template.query(sql,new BeanPropertyRowMapper(AddNumberDto.class));
	}

}
